//
//  MAPYIPResultInfoCell.swift
//  Mars Proxy
//
//  Created by PowerfullClean on 2023/10/18.
//

import UIKit

class MAPYIPResultInfoCell: MAPYTestResultInfoCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        mapy_iconView3.addSubview(mapy_loctionview)
        mapy_iconView3.addSubview(mapy_cityView)
        mapy_iconView3.addSubview(mapy_regionView)
        mapy_iconView3.addSubview(mapy_countryView)
        mapy_iconView2.image = UIImage(named: "mapy_result_testIp")
        mapy_loctionview.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.left.equalToSuperview().offset(56)
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_cityView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.right.equalToSuperview()
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_regionView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.left.equalToSuperview().offset(56)
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_countryView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.right.equalToSuperview()
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    var mapy_ipScanModel: MAPYIPScanModel? {
        didSet {
            guard let mapy_ipScanModel = mapy_ipScanModel else { return }
            mapy_loctionview.mapy_valueLabel.text = mapy_ipScanModel.mapy_loction
            mapy_cityView.mapy_valueLabel.text = mapy_ipScanModel.mapy_city
            mapy_regionView.mapy_valueLabel.text = mapy_ipScanModel.mapy_region
            mapy_countryView.mapy_valueLabel.text = mapy_ipScanModel.mapy_country
        }
    }
    
    lazy var mapy_loctionview: MAPYTestResultInfoItemView = {
        let mapy_loctionview = MAPYTestResultInfoItemView()
        mapy_loctionview.mapy_titleLabel.text = "Location"
        mapy_loctionview.mapy_valueLabel.text = "0"
        return mapy_loctionview
    }()
    lazy var mapy_cityView: MAPYTestResultInfoItemView = {
        let mapy_cityView = MAPYTestResultInfoItemView()
        mapy_cityView.mapy_titleLabel.text = "City"
        mapy_cityView.mapy_valueLabel.text = "0"
        return mapy_cityView
    }()
    lazy var mapy_regionView: MAPYTestResultInfoItemView = {
        let mapy_regionView = MAPYTestResultInfoItemView()
        mapy_regionView.mapy_titleLabel.text = "Region"
        mapy_regionView.mapy_valueLabel.text = "0"
        return mapy_regionView
    }()
    lazy var mapy_countryView: MAPYTestResultInfoItemView = {
        let mapy_countryView = MAPYTestResultInfoItemView()
        mapy_countryView.mapy_titleLabel.text = "Country"
        mapy_countryView.mapy_valueLabel.text = "0"
        return mapy_countryView
    }()
}
